package com.wanmait.employment.manageController;

import com.wanmait.employment.entity.EntryTime;
import com.wanmait.employment.service.EntryTimeService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/manage/EntryTime")
public class EntryTimeController {
    @Resource
    private EntryTimeService entryTimeService;
    @GetMapping("list")
    public AjaxResult list(String title)
    {
        List<EntryTime> entryTimeList= entryTimeService.selectList(title);
        return AjaxResult.success(entryTimeList);
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody EntryTime entryTime){
        if(entryTime.getId()!=null) {
            entryTimeService.update(entryTime);
            return AjaxResult.success("成功");
        }
        entryTimeService.insert(entryTime);
        return AjaxResult.success("成功");
    }
    @GetMapping("delete")
    public AjaxResult delete(Integer id){
        entryTimeService.delete(id);
        return AjaxResult.success("成功");
    }

}
